Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

295
Views
Rewrite Rules with [R=301] in .htaccess

I have decided to introduce folders into my URLs for SEO reasons. Now im trying to 301 all the old URLs.

The physical location of these 100+ pages is in the root:

www.mydomain.com/pageA1.php
www.mydomain.com/pageA2.php
www.mydomain.com/pageB1.php
www.mydomain.com/pageB2.php

I now want the URLs to include a folder name - but the physical location to stay the same:

www.mydomain.com/a-waste/pageA1.php
www.mydomain.com/a-waste/pageA2.php
www.mydomain.com/b-waste/pageB1.php
www.mydomain.com/b-waste/pageB2.php

My current rules are:

RewriteRule a-waste/pageA1.php /pageA1.php
RewriteRule a-waste/pageA2.php /pageA2.php
RewriteRule b-waste/pageB1.php /pageB1.php
RewriteRule b-waste/pageB2.php /pageB2.php

This works fine in the sense that if I browse www.mydomain.com/a-waste/pageA1.php - this URL stays in my address bar and it shows the page physically located www.mydomain.com/pageA1.php.

Now if I add [R=301,L] to this rule to tell google its permanent, it no longer rewrites the URL, it just redirects it instead? What am i missing?

thanks. Alex.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!